depending on the configuration there may be multiple
interfaces creating multiple time series always
reporting 0 value. omiting them from the export saves
resources. most notably cpu. this is limited to
counter types
Signed-off-by: Markus Hube <[email protected]>
include $(TOPDIR)/rules.mk
PKG_NAME:=prometheus-node-exporter-lua
-PKG_VERSION:=2025.07.15
+PKG_VERSION:=2025.11.22
PKG_RELEASE:=1
start_service() {
. /lib/functions/network.sh
- local interface port listenflag cert key bind4 bind6
+ local interface port listenflag cert key bind4 bind6 omit_zero_values
config_load prometheus-node-exporter-lua.main
config_get keepalive "main" http_keepalive 70
config_get port "main" listen_port 9100
config_get cert "main" cert
config_get key "main" key
+ config_get omit_zero_values "main" omit_zero_values 0
[ "$interface" = "*" ] || {
network_get_ipaddr bind4 "$interface"
procd_open_instance
+ [ "$omit_zero_values" -eq 1 ] && procd_set_param env OMIT_ZERO_VALUES=1
+
procd_set_param command /usr/sbin/uhttpd -f -c /dev/null -l / -L /usr/bin/prometheus-node-exporter-lua
[ $keepalive -gt 0 ] && procd_append_param command -k $keepalive
socket = require("socket")
+-- get configs
+
+local omit_zero_values = os.getenv("OMIT_ZERO_VALUES") == "1"
+
-- Parsing
function space_split(s)
function metric(name, mtype, labels, value)
out:write("# TYPE ", name, " ", mtype, "\n")
+ -- omit_zero_vales config supress time series always being zero
+ local printall = not (mtype == "counter" and omit_zero_values)
local outputter = function(labels, value)
- print_metric(name, labels, value)
+ if printall or tonumber(value) ~= 0 then
+ print_metric(name, labels, value)
+ end
end
if value then
outputter(labels, value)